import { MenuEntity } from "@/src/menu/entities/menu.entity"
import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from "typeorm"

@Entity('menu_detail')
export class MenuDetailEntity {
  @PrimaryGeneratedColumn()
  id: number

  @Column()
  menu_id: number

  @Column({ type: 'text', nullable: true })
  description: string

  @Column({ type: 'text', nullable: true })
  ingredients: string

  // 与menu表的关系
  @OneToOne(() => MenuEntity, menu => menu.detail)
  @JoinColumn({ name: 'menu_id' })
  menu: MenuEntity
}